home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / utility / clustr.zip / CLUSTER.DOC < prev    next >
Text File  |  1993-11-19  |  16KB  |  339 lines

  1.        ╒══════════════════════════════════════════════════════════════╕
  2.        │  Note bene: Use the <Esc> key to EXIT when finished reading  │
  3.        ╘══════════════════════════════════════════════════════════════╛
  4.  
  5.                    Clusters, Sectors and -BIG- Hard Drives
  6.                                           
  7.                               18 November, 1993
  8.                                           
  9.                                    6:41 PM
  10.        
  11.        Last week  I uploaded  to CompuServe  a simple  program  called
  12.        CLUSTER.COM. This  is "son  of CLUSTER.COM" with more bells and
  13.        whistles.
  14.        
  15.        CLUSTER.COM's main purpose is to inform you folk who are buying
  16.        a new  humongous hard drive (greater than 127 Megabytes) how to
  17.        set up that new hard drive to have the smallest Clusters.
  18.        
  19.        One file  occupies one  Cluster. If the file is 1 byte long and
  20.        your Cluster  size is  "8 K"  then there  are 8,195 empty bytes
  21.        sitting on your hard drive that no other file can use. For lack
  22.        of a better term let's call that empty space "Slack Space," and
  23.        while I  am at  it, allow  me to  use the  abbreviation "K" for
  24.        Kilobytes and "MB" for Megabytes.
  25.        
  26.        The reason  I got  into all  of this weird stuff about Clusters
  27.        and Sectors  is that my very first computer was a 100 MB Zenith
  28.        laptop that  I bought  on sale. As that hard drive filled up, I
  29.        noticed that  there was  a lot of "Slack Space." Slack Space is
  30.        hard drive disk space not used by files. So even though I had a
  31.        100 MB  hard drive,  I ran out of room at about 88 MB of files.
  32.        That's when  I discovered  that with DOS 3.3 and one large hard
  33.        drive partition, I had 8 K Clusters. That was with DOS 3.3, DOS
  34.        5.0 does not do that.
  35.        
  36.        So now..  the little  light bulb  probably has  gone on in your
  37.        head as  you realize  that if  you have eight kilobyte Clusters
  38.        and a  lot of  little files... you are LOSING MEGABYTES OF DISK
  39.        SPACE.
  40.        
  41.        The answer  to large  Cluster size  on your hard drive (IF your
  42.        hard drive  has 4  or  8  K  Clusters),  is  to  FDISK.EXE  and
  43.        FORMAT.COM the  hard drive  (using DOS  5.0 or  better) to make
  44.        MULTIPLE PARTITIONS.  Do this ONLY AFTER you have backed up all
  45.        your files  to diskettes and TEST the restore process, or after
  46.        using two tapes to back up and compare your programs and files.
  47.        
  48.        Being  just  an  information  source,  it  doesn't  sound  like
  49.        CLUSTER.COM will  win the Nobel Peace prize... does it? Some of
  50.        you are  saying you  can get all this stuff by using CHKDSK.EXE
  51.        which comes with DOS. True, true just typing "CHKDSK C:" on the
  52.        DOS command  line and  "executing" that  command will  give you
  53.        your Cluster size and hard disk size. See... I just "shelled to
  54.        DOS" and did that for you:
  55.        ───────────────────────────────────────────────────────────────
  56.             Volume Serial Number is 1B6C-A179
  57.             
  58.             104,380,416 bytes total disk space
  59.              79,872 bytes in 2 hidden files
  60.             362,496 bytes in 105 directories
  61.              95,496,192 bytes in 6,650 user files
  62.             262,144 bytes in bad sectors
  63.               8,179,712 bytes available on disk
  64.             
  65.               2,048 bytes in each allocation unit
  66.              50,967 total allocation units on disk
  67.               3,994 available allocation units on disk
  68.             
  69.             655,360 total bytes memory
  70.             347,296 bytes free
  71.             
  72.             Instead of using CHKDSK, try using SCANDISK.  SCANDISK can
  73.             reliably detect and fix a much wider range of disk
  74.             problems.  For more information, type HELP SCANDISK from
  75.             the command prompt.
  76.        ───────────────────────────────────────────────────────────────
  77.        
  78.        See those "Clusters?" No? Well DOS calls "Clusters" "allocation
  79.        units." The example above shows that this little ole laptop has
  80.        a Cluster  size of  2,048 bytes.  That is  the -smallest- sized
  81.        cluster you  can have  on a  DOS hard  drive. Sure you can have
  82.        Clusters as small as one Sector, or 512 bytes on your RAM drive
  83.        but that  is a  "logical" drive  not a  "real" drive.  Floppies
  84.        usually have a Cluster size of 1024 bytes. If you remember just
  85.        this, you  know more  about  Clusters  and  Sectors  than  most
  86.        computer salesmen.
  87.        
  88.        CLUSTER.COM gives you the results of some mathematical formulas
  89.        to calculate  "bytes," "kilobytes," and "megabytes." Then let's
  90.        you know what the maximum size hard drive you can make with:
  91.        
  92.        1. 2 kilobyte Clusters (2048 bytes/Cluster)
  93.        2. 4 kilobyte Clusters (4096 bytes/Cluster)
  94.        3. 8 kilobyte Clusters (8196 bytes/Cluster)
  95.        
  96.        A "kilobyte" is NOT one-thousand (1,000) bytes but one-thousand
  97.        and twenty-four  (1,024) bytes.  This kind  of stuff  makes  me
  98.        CRAZY as  the prefix "kilo" means thousand so that a "kilogram"
  99.        is a  thousand grams  and all  other "kilos"  are a  nice round
  100.        thousand... except in computer terms.
  101.        
  102.        I have  asked some  of the "computer experts" I know to explain
  103.        how come  a "kilobyte" (K) is 1,024 bytes and a "megabyte" (MB)
  104.        is 1,048,576  bytes. They  tell me  it makes  perfect sense  to
  105.        them... but they CAN'T explain it to me.
  106.        
  107.        A byte stores the computer data for a single character. By some
  108.        strange thinking  it was  decided that  a kilobyte is "2 to the
  109.        10th power"  or as  QuickBASIC likes  to see  that formula  as:
  110.        "2^10." And... a megabyte is: "2^20."
  111.        
  112.        This is  where CLUSTER.COM  comes in. After you read this stuff
  113.        and exit  the text file by pressing <Esc>, you can find out how
  114.        many 2K Cluster, 127 MB Partitions you should make for your new
  115.        huge hard drive.
  116.        
  117.        According to  my favorite  PC Reference,  "DOS Power Tools, 2nd
  118.        Edition, Revised  for DOS  5.0; by  Paul Somerson,  1991,  page
  119.        763"; there are only a total of 65,518 CLUSTERS in a hard drive
  120.        Partition. Each  file's location  information requires one byte
  121.        located in  one DOS  Segment. One DOS Segment has 65,536 bytes.
  122.        We know that 16 bytes are needed for the "Partition Loader" per
  123.        Partition so that 2 bytes are used for something else.
  124.        
  125.        PC Magazine and others have written about Clusters and used the
  126.        number 65,536  to calculate the maximal hard drive size, and...
  127.        they are  WRONG. The  correct number  is 65,518.  Therefore the
  128.        MAXIMAL hard  drive that  you can  make is NOT 128 MB as others
  129.        may have told you, but 127. The math is simple.
  130.        
  131.        If you  are one  of my  "Junior Propeller Hat" friends and have
  132.        looked at  CLUSTER.BAS in  dismay because it contains code that
  133.        doesn't look like QuickBASIC... be of good cheer, if you know a
  134.        modest amount  of QuickBASIC,  you can translate it into a one-
  135.        hundred percent  QuickBASIC program  and run  it. If you can't,
  136.        give me  a "ring"  and  I'll  show  you  how.  CLUSTER.BAS  has
  137.        Crescent Software's  PDQ code  as otherwise the executable file
  138.        CLUSTER.COM, would be over 66 K in size.
  139.        
  140.        And lastly,  I have  included two  references from  Microsoft's
  141.        Knowledge Base  Forum on  CompuServe that  speak to this stuff,
  142.        just so you know I am giving you the "straight skinny."
  143.        
  144.        John De Palma on CompuServe 76076,571
  145.        
  146.                                  REFERENCES
  147.        ───────────────────────────────────────────────────────────────
  148.                                           
  149.                           Knowledge Base CIS
  150.  
  151. Title: MS-DOS Partitioning Summary
  152. Document Number: Q69912
  153. Publ Date: 24-AUG-1993
  154. Product Name: Microsoft Disk Operating System Product Version: 2.x 3.x
  155. 4.x 5.x 6.00 Operating System: MS-DOS
  156.  
  157. ----------------------------------------------------------------
  158. The information in this article applies to:
  159.  
  160. - Microsoft MS-DOS operating system version 2.x, 3.x, 4.x, 5.x, and
  161. 6.0
  162. --------------------------------------------------------
  163.  
  164. SUMMARY =======
  165.  
  166. This article contains a summary of MS-DOS partitioning information.
  167. For information on how MS-DOS assigns drive letters, query on the
  168. following words in the Microsoft Knowledge Base:
  169.  
  170. msdos and order and assign and drive and letter
  171.  
  172. MORE INFORMATION ================
  173.  
  174. A hard disk's master boot record (MBR) is located in the first sector
  175. of the disk (cylinder 0, side 0, sector 1). The partition table is
  176. located at offset 01BE, containing up to four 16-byte entries. The
  177. fourth byte of each partition table entry is used to mark the
  178. partition type.
  179.  
  180. MS-DOS began supporting hard disks in version 2.0. In MS-DOS versions
  181. 2.x, MS-DOS supports one type 01 partition of up to 32 megabytes (MB)
  182. in size, which use a 12-bit file allocation table (FAT). FDISK creates
  183. only one MS-DOS partition per drive.
  184.  
  185. In MS-DOS 3.0, partitions larger than 15 MB use a 16-bit FAT, which
  186. allows a smaller cluster size and thus more efficient disk usage. As a
  187. result, MS-DOS 2.x hard drives larger than 15 MB are incompatible with
  188. later versions of MS-DOS. Again, FDISK creates only one MS-DOS
  189. partition per drive.
  190.  
  191. In version 3.3, MS-DOS introduced support for more than one logical
  192. drive per hard disk. Logical drives are treated as completely separate
  193. disks under MS-DOS, even though they may occupy the same physical hard
  194. disk.
  195.  
  196. This was supported by introducing nonbootable MS-DOS partitions known
  197. as extended MS-DOS partitions. FDISK reports these as EXT DOS; other
  198. MS-DOS partitions began to be reported as PRI DOS, for primary MS-DOS.
  199. Each primary MS-DOS partition is a logical drive, and extended MS-DOS
  200. partitions contain from 1 to 23 logical drives (MS-DOS supports drive
  201. letters up to Z). Logical drives in extended MS-DOS partitions have
  202. the same FAT type as a primary MS-DOS partition of the same size.
  203.  
  204. Only one PRI DOS partition and one EXT DOS partition is allowed per
  205. drive. On machines with two physical hard drives, a PRI DOS partition
  206. is not required on the second physical disk. A PRI DOS partition is
  207. required on the first physical disk. (MS-DOS would not support more
  208. than two physical disks.)
  209.  
  210. Version 4.0 introduced logical drives larger than 32 MB. Full usage of
  211. these logical drives requires the MS-DOS program SHARE.EXE to be
  212. loaded.
  213.  
  214. The following table explains the current (versions 4.x through 6.0)
  215. MS-DOS partition types:
  216.  
  217. Partition FDISK                                        Introduced
  218. Type      Reports        Size           FAT Type       in MS-DOS
  219.                                                        Version
  220.  ---------  -------      ------          ---------   -----------
  221.  
  222.     01      PRI DOS       0 - 15 MB      12-Bit      2.0 (a)
  223.     04      PRI DOS      16 - 32 MB      16-Bit      3.0
  224.     05      EXT DOS       0 -  2 GB (b)    n/a       3.3
  225.     06      PRI DOS   32 MB -  2 GB (b)  16-bit      4.0
  226.  
  227. (a) 15 MB size limitation added in 3.0
  228.  
  229. (b) 2 GB (gigabytes) includes a limit of 1024 cylinders per drive
  230. imposed by the standard AT ROM BIOS interrupt 13 protocol
  231.  
  232. MS-DOS versions 5.0 and 6.0 support the same partitioning strategy as
  233. versions 4.x, including FDISK's refusal to create more than one
  234. primary MS-DOS partition on a physical disk. However, because some
  235. original equipment manufacturers (OEMs) allow more then one primary
  236. MS-DOS partition, MS-DOS 5.0 and 6.0 support more than one primary MS-
  237. DOS partition on a physical disk for compatibility reasons.
  238.  
  239. MS-DOS 5.0 and 6.0 also support up to eight physical hard drives.
  240. SHARE.EXE is not required for full large-drive support; this support
  241. is included in the MS-DOS kernel.
  242.  
  243. NOTE: Many OEMs have changed their MS-DOS to support more than one
  244. primary MS-DOS partition, larger type 04 partitions, and/or introduced
  245. new partition types.
  246.  
  247. Additional reference words: 3.0 3.00 3.10 3.1 3.3 3.30 3.3a 3.30a 4.0
  248. 4.00 4.01 4.01a 5.00 5.0 5.00a 5.0a 6.0
  249.  
  250. COPYRIGHT Microsoft Corporation, 1993.
  251. _________________________________________________________________
  252.                           Knowledge Base CIS
  253.  
  254. Title: FAT Type and Cluster Size Depends on Logical Drive Size
  255. Document Number: Q67321
  256. Publ Date: 4-NOV-1993
  257. Product Name: Microsoft Disk Operating System Product Version: 3.x 4.x
  258. 5.x 6.00 6.20 Operating System: MS-DOS
  259.  
  260. ---------------------------------------------------------------- The
  261. information in this article applies to:
  262.  
  263. - Microsoft MS-DOS operating system versions 3.x, 4.x, 5.x, 6.0 and
  264. 6.2 --------------------------------------------------------
  265.  
  266. SUMMARY =======
  267.  
  268. MS-DOS allocates disk space for files in units of one or more sectors;
  269. these units are called "clusters" or "allocation units." On any MS-DOS
  270. disk, a 1-byte file is allocated 1 cluster of disk space, wasting the
  271. unused area of the cluster. A file that is 3.2 clusters large is given
  272. 4 clusters. Overall, a smaller cluster size means less waste.
  273.  
  274. The cluster size for a drive is decided by FORMAT, depending on the
  275. size of the logical drive (see table, below). "Logical drive" refers
  276. to an MS-DOS volume accessed by a drive letter (A:, B:, C:, D:, and so
  277. forth). Hard disk users may want to consider cluster size when
  278. choosing how to partition their drive(s).
  279.  
  280. The cluster size of a floppy drive cannot be changed. The cluster size
  281. of a hard drive can be changed only by changing the size of the
  282. logical drive, which is done by repartitioning the hard drive.
  283.  
  284. CHKDSK displays the allocation unit size for a logical drive. FDISK's
  285. option 4 displays the size(s) of logical drives on the hard drive(s).
  286.  
  287. NOTE: DoubleSpace-compressed drives appear to have 8K clusters, but
  288. internally vary the sectors-per-cluster as necessary (this information
  289. is recorded in the MDFAT). For example, a 10K file which compresses by
  290. a factor of 2:1 actually uses 5K, or 10 sectors, of drive space.
  291.  
  292. MORE INFORMATION ================
  293.  
  294. The following is a table of logical drive sizes, FAT (File Allocation
  295. Table) types, and cluster sizes:
  296.  
  297. Table) types, and cluster sizes:
  298.  
  299.                    Drive Size      FAT Type     Sectors     Cluster
  300.               (logical volume)              Per Cluster     Size
  301.             ----------------   --------   -----------   -------
  302.  
  303. (Floppy Disks)      360K           12-bit         2          1K
  304.                     720K           12-bit         2          1K
  305.                   1.2 MB          12-bit         1      512 bytes
  306.                  1.44 MB         12-bit         1       512 bytes
  307.                  2.88 MB         12-bit         2            1K
  308.  
  309.  
  310. (Hard Disks)     0 MB - 15 MB      12-bit         8          4K
  311.                  15 MB - 127 MB     16-bit         4         2K
  312.                128 MB - 255 MB     16-bit         8          4K
  313.                 256 MB - 511 MB     16-bit        16         8K
  314.                 512 MB - 1023 MB    16-bit        32        16K
  315.                1024 MB - 2048 MB    16-bit        64        32K
  316.  
  317. NOTES:
  318.  
  319. - Sectors are 512 bytes in size, except on some RAM drives.
  320.  
  321. - In the past, some OEMs have modified their versions of MS-DOS to
  322. support other sector and/or cluster sizes. The Microsoft MS-DOS 5
  323. Upgrade Setup will, if possible, convert the logical drive to MS-DOS
  324. 5.0 compatible. This entails converting the sector size to 512 bytes
  325. while retaining the nonstandard cluster size.
  326.  
  327. - MS-DOS determines the FAT size based on the number of clusters. If
  328. there are 4085 or fewer clusters, a 12-bit FAT is used. If there are
  329. 4086 or more clusters, a 16-bit FAT is used.
  330.  
  331. For more information on this topic, query on the following words:
  332.  
  333. cluster and disk and FAT
  334.  
  335. Additional reference words: 3.20 3.21 3.30 3.30a 4.00 4.01 5.00 5.00a
  336. partition allocation unit 6.00 6.20
  337.  
  338.        COPYRIGHT Microsoft Corporation, 1993.
  339.